import { createRouter, createWebHistory } from 'vue-router';
import Login from '../components/Login.vue';
import Map from '../components/Map.vue';
import Register from '../components/Register.vue';
import Guide from "../components/Guide.vue";
import Submit from "../components/Submit.vue";
import MapView from "../components/MapView.vue";
import AdminView from "../components/AdminView.vue";

const routes = [
    { path: '/', component: Login },
    { path: '/login', component: Login },
    { path: '/map', component: MapView },
    { path: '/register', component: Register },
    { path: '/guide', component: Guide},
    { path: '/submit', component: Submit},
    {
        path: '/admin',
        component: AdminView,
    },
    {
        path: '/home',
        component: () => import('../view/home/Home.vue'),
        children: [
            {
                path: 'official',
                component: () => import('../components/MapView.vue'),
            },
            {
                path: 'community',
                component: () => import('../components/DataCheck.vue'),
            },
            {
                path: 'userDistribution',
                component: () => import('../components/Submit.vue'),
            }
        ]
    }
];

const router = createRouter({
    history: createWebHistory(),
    routes,
});

// 添加全局路由守卫


export default router;
